/**
 ****************************************
 * @file middle.h
 * @author: AnRui
 * @version 0.1
 * @date  : 2025-11-10
 * @copyright Copyright (c) 2025
 * @desc: 中间层 接收busi层的信号量 然后向驱动层发起请求
 *        从驱动层返回的数据 在返回被busi层
 *
 * ***************************************
 */
#ifndef _MIDDLE_H_
#define _MIDDLE_H_
#include "gd32f30x.h"
#include <stdio.h>
#include "user_mb_app.h"
#include <stdbool.h>
#include "FreeRTOS.h"
#include "task.h"
#include "total_config.h"
#include "business.h"
#include "mmc.h"
#include "switch_drv_adapter.h"
#include "sample_drv_adapter.h"
typedef struct {
  int temperature;
  bool is_valid;
} midlayer_sample_temperature_t;

typedef struct {
  int bright;
  bool is_valid;
} midlayer_sample_bright_t;

typedef struct {
  light_status_e light_status;
} midlayer_switch_light_t;

typedef struct {
  fan_status_e fan_status;
} midlayer_switch_fan_t;

/**
 * @desc  : 中间层初始化
 * @date  : 2025-11-06
 * @author: AnRui
 * @note  : 中间层: 采集模块 控制模块 freemodbus
 */
void middle_layer_init(void);

extern mmc_ctrl_t midlayer_sample_tempraure_mmc_ctrl;
extern mmc_ctrl_t midlayer_sample_bright_mmc_ctrl;
extern mmc_ctrl_t midlayer_switch_light_mmc_ctrl;
extern mmc_ctrl_t midlayer_switch_fan_mmc_ctrl;

#endif
